home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / c / CLib-SDI.lha / CLib-SDI / libsource / examplefuncs.c next >
C/C++ Source or Header  |  2002-10-27  |  2KB  |  57 lines

  1. #ifndef EXAMPLE_EXAMPLEFUNCS_C
  2. #define EXAMPLE_EXAMPLEFUNCS_C
  3.  
  4. /* Programmheader
  5.  
  6.     Name:        examplefuncs.c
  7.     Main:        example
  8.     Versionstring:    $VER: examplefuncs.c 1.1 (21.09.2002)
  9.     Author:        SDI
  10.     Distribution:    Freeware
  11.     Description:    the example library function file
  12.  
  13.  1.0   25.06.00 : created that example library code
  14.  1.1   21.09.02 : added hook function
  15. */
  16.  
  17. #include <proto/example.h>
  18. #include <proto/intuition.h>
  19. #include <proto/utility.h>
  20. #include <SDI_compiler.h>
  21. #define BASE_REDEFINE    /* either this or BASE_GLOBAL is active */
  22. #include "libinfo.h"
  23.  
  24. /* this one shows how to call own library functions */
  25. ASM(LONG) LIBex_TestRequest(REG(a0, UBYTE *title), REG(a1, UBYTE *body),
  26. REG(a2, UBYTE *gadgets), REG(a6, struct ExampleBaseP *ExampleBase))
  27. {
  28.   return ex_TestRequest2A(title, body, gadgets, NULL);
  29. }
  30.  
  31. /* this one shows how functions with variable argument lists are handled */
  32. ASM(LONG) LIBex_TestRequest2A(REG(a0, STRPTR title), REG(a1, STRPTR body),
  33. REG(a2, STRPTR gadgets), REG(a3, APTR args), REG(a6, struct ExampleBaseP *ExampleBase))
  34. {
  35.   struct EasyStruct estr;
  36.  
  37.   estr.es_StructSize   = sizeof(struct EasyStruct);
  38.   estr.es_Flags        = NULL;
  39.   estr.es_Title        = title;
  40.   estr.es_TextFormat   = body;
  41.   estr.es_GadgetFormat = gadgets;
  42.  
  43.   ++ExampleBase->exb_NumCalls;
  44.  
  45.   return EasyRequestArgs(NULL, &estr, NULL, args);
  46. }
  47.  
  48. /* this one shows how to use callback hooks */
  49. ASM(ULONG) LIBex_TestRequest3(REG(a0, struct Hook *hook),
  50. REG(a6, struct ExampleBaseP *ExampleBase))
  51. {
  52.   return CallHookPkt(hook, "object a2", "param a1");
  53. }
  54.  
  55. #endif /* EXAMPLE_EXAMPLEFUNCS_C */
  56.  
  57.